	<script type="text/javascript">
	    $(document).ready(function() { // fungsi pada javascript onReady
	      	// FUNGSI VALIDASI FORM
	      	$("#form").validate({
		        rules: {
		        	name: { // NAMA
		        		required: true,
		        		minlength: 2
		        	},
		        	email: { // EMAIL
		        		required:true,
		        		email: true
		        	},
		        },
		        messages: {
		          name: {
		          	required: "nama masih kosong",
		          	minlength: "masukkan nama yang valid"
		          },
		          email: "alamat e-mail tidak valid",
		        }
	      	});

	      	// FUNGSI AJAX UNTUK FETCH PESAN OTOMATIS SETELAH TOMBOL DI KLIK
	      	$("#form").ajaxForm(function(){
		      	$.ajax({
		        type:"POST",
		        url:"<?php echo base_url(); ?>",

		        success:function (data) {
		        	console.log('cek');
		            $('body').html(data);
		        }
		      	});
	      	});
	    });
  	</script>
<div class="container-fluid">
	<div class="row-fluid">
		<div class="span2">
			<br><br><br>
	<?php
		// FORM
		$submitclass = 'class="btn btn-primary required"';
		echo validation_errors(); 
		$attributes = array('id' => 'form' );
		echo form_open('', $attributes); 
		echo form_input('name', set_value('name'), 'placeholder="Nama"') . "<br>";	
		echo form_input('email', set_value('email'), 'placeholder="E-Mail: your@example.com"'). "<br>";		
		echo form_textarea('pesan', '', 'placeholder="Isi Pesan"'). "<br>";
		echo form_submit('submit', 'Submit', $submitclass) . "  ";
		echo form_reset('reset', 'Reset', 'class="btn"');
		echo form_close();
	?>
	</div>
	<div class="span5"><h1>Dini Lestari Tresnani</h1></div>
	<div class="span9">
	<?php 
		// MENAMPILKAN ISI PESAN PADA DATABASE
		foreach ($pesan as $eachpesan) { 
			?>
				<div class="well well-small">
					<h5><?php echo $eachpesan['nama']; ?> <small><?php echo $eachpesan['email'] ?></small></h5>
					<blockquote>
						<p><?php echo $eachpesan['pesan'] ?></p>
						<small><?php 
						if ($eachpesan['timestamp']>=(time() - 24*60*60))
						{
							echo timespan($eachpesan['timestamp'], time()). " ago";
						}
						else
						{
							echo unix_to_human($eachpesan['timestamp']);
						} ?>
						</small>
					</blockquote>
				</div>
<?php	}
	?>
	</div>
	</div>
</div>